package com.study.exception;

import com.study.enums.ResultCodeEnum;

/**
 * 自定义异常类
 */
public class MyException extends RuntimeException {
    private ResultCodeEnum codeEnum; // 状态

    public MyException(String message) {
        super(message);
    }

    /**
     * 自定义错误码和错误消息
     */
    public MyException(ResultCodeEnum codeEnum, String error){
        super(error);
        this.codeEnum = codeEnum;
    }

    /**
     * 自定义错误码
     */
    public MyException(ResultCodeEnum codeEnum){
        this.codeEnum = codeEnum;
    }

    public ResultCodeEnum getCodeEnum() {
        return codeEnum;
    }
}
